#!/bin/bash

if [ $# -ne 6 ]; then echo "Usage: ./streams [width] [height] [bitrate] [tohost] [toport] [datafile]"; exit; fi

DIR=/home/`whoami`/collaborationgrid

killall gst-launch-0.10
sleep 1

WIDTH=$1
HEIGHT=$2
BITRATE=$3
TOHOST=$4
TOPORT=$5
FILE=$6

while read line
do
	ADDR=`echo $line|awk '{print $1}'`
	PORT=`echo $line|awk '{print $2}'`
	NAME=`echo $line|awk '{print $3}'`
	
	echo $ADDR $PORT $NAME
	$DIR/gst-transcode-rtp-h264.sh -sip $ADDR -sport $PORT -width $WIDTH -height $HEIGHT -br $BITRATE -dip $TOHOST -dport $TOPORT -name $NAME &
done < $FILE
